import static java.lang.Thread.sleep;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-03-30
 * Time: 12:54
 */
public class test_4 {
    public static void main(String[] args) throws InterruptedException {
        Runnable runnable =new runthread(){
            @Override
            public void run() {
                while (true) {
                    try {
                        sleep(1000);
                        System.out.println("继承 Thread, 重写 run, 使用匿名内部类");
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        };
        Thread t =new Thread(runnable);
        t.start();
        while (true) {
            sleep(1000);
            System.out.println("main主线程");

        }
    }
}
